<?php
namespace App\Admin\Extensions\Grid\Tool;

use Encore\Admin\Grid\Tools\AbstractTool;
use Illuminate\Support\Facades\Request;
class Export extends AbstractTool
{
    protected $urlStr;

    public function __construct($urlStr)
    {
        $this->urlStr = $urlStr;
    }

    public function render()
    {
        $downloadUrl = '/xqc/' . $this->urlStr . '?' . http_build_query(Request::all());
        return <<<EOT
    <div class="btn-group">
        <a class="btn btn-sm btn-twitter" href="{$downloadUrl}" target="_blank"><i class="fa fa-download"></i> 导出</a>
    </div>
EOT;
    }
}
